<template>
    <div v-if="showMe">
      <back :name="msg"></back>
      <div class="username">
          <div class="users">
            <img src="/static/img/slider-pic11.b7f4326.jpeg" alt="">
            <div class="username-s">
              <p class="username-text" v-text="name"></p>
              <p class="user-phone">186*****273</p>
            </div>
          </div>
      </div>
      <ul class="widas">
         <li v-for="ge in gen">
           <div>
             <p><span class="su">{{ge.one}}</span><span>{{ge.dw}}</span></p>
             <p><span class="zi">{{ge.two}}</span></p>
           </div>
         </li>
      </ul>
      <ul class="lieb">
        <li>
          <svg>
            <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#order.070ae2a"></use>
          </svg>
          <span><a href="javascript:;">我的订单</a></span>
        </li>
        <li>
          <svg>
            <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#shop"></use>
          </svg>
          <span>积分商城</span>
        </li>
        <li>
          <svg>
            <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#eleme"></use>
          </svg>
          <span>饿了么会员卡</span>
        </li>
        <li class="one-der">
          <svg>
            <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#discover.5811137"></use>
          </svg>
          <span>服务中心</span>
        </li>
        <li>
          <svg>
            <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#index.18edf5a"></use>
          </svg>
          <span>下载饿了么App</span>
        </li>
      </ul>
      <footernav></footernav>
    </div>
</template>

<script>
    // import HeaderComponent from './components/header.vue'
    import back from './../components/home/backTitle.vue'
    import footernav from './../components/commonality/footer_nav.vue'
    import { mapGetters } from 'vuex';
    export default{
      components: {
        back,
        footernav
      } ,
        //父组件传入的数据
        props: {} ,
        //本地数据
        data(){
            return {
                showMe:false,
                msg: '我的',
                name: this.$store.state.name,
                gen:[
                  {
                    one:'12.00',
                    two:'余额',
                    dw:'元'
                  },
                  {
                    one:'12',
                     two:'优惠',
                    dw:'个'
                  },
                  {
                    one:'1200',
                    two:'积分',
                    dw:'分'
                  }
                ]
            }
        } ,
        //方法
        methods: {} ,
        //进入页面加载
        mounted () {
          if(!this.isLogin){
            this.$router.push({"name":"login"})
          }
           // 设置当前状态为加载中
          this.$store.dispatch('setLoading', true);
          // 模拟请求等待
          var time = Math.floor(Math.random() * 2000);
          console.log('模拟加载用时' + time);
          setTimeout(() => {
            // 页面显示
            this.$store.dispatch('setLoading', false);
            this.showMe = true;
          }, time);
        } ,
        //计算属性
        computed: {
          isLogin () {
            return this.$store.getters.getIsLogin;
          }
        } ,
        //监控数据变化
        watch: {}

    }
</script>

<style lang="less" scoped>
.username{
  width: 100%;
  height: 1.1rem;
  background: #0097ff;
  border-top: 1px solid #dedede;
  box-sizing: border-box;
  padding: 0.25rem 0.2rem 0.25rem 0.2rem;
}
.users{
  width: 100%;
}
.users img{
  width: 0.5rem;
  height: 0.5rem;
  float: left;
}
.username-s{
  float: left;
  margin-left: 0.15rem;
}
.username-text{
  font-size: 0.25rem;
  color: #fff;
  text-align: center;
  font-weight: 600;
}
.user-phone{
  font-size: 0.16rem;
  color: #fff;
  line-height: 0.3rem;
}
.widas{
  width: 100%;
  height: 1rem;
  background: #fff;
}
.widas li{
  width: 33%;
  height: 100%;
  float: left;
}
.widas li div{
  margin-top: 0.3rem;
}
.widas li p{
  text-align: center;
}
.su{
  font-size: 0.22rem;
  font-weight: 600;
}
li:nth-last-child(1) .su{
  color:rgb(106, 194, 11)
}
li:nth-last-child(2) .su{
  color:rgb(255, 95, 62)
}
li:nth-last-child(3) .su{
  color:rgb(255, 153, 0)
}
.widas li:nth-last-child(2){
  border-left: 1px solid rgb(221, 221, 221);
  border-right: 1px solid rgb(221, 221, 221);
}
.lieb{
  width: 100%;
  margin-top: 0.1rem;
}
.lieb li{
  width: 100%;
  height: 0.4rem;
  border-bottom: 1px solid #dedede;
  padding-left: 0.15rem;
  position: relative;
  background: #fff;
}
.lieb li svg{
  width: 0.15rem;
  height: 0.15rem;
  margin-top: 0.12rem;
}
.lieb li span{
  position: absolute;
  top:0;
  margin-top: 0.08rem;
  margin-left: 0.12rem;
  font-size: 0.16rem;
}
  .one-der{
    margin-top: 0.15rem;
  }
</style>
